package cn.hallele.leinsteining.ms.auditcenter.service.log.listener;

import cn.hallele.leinsteining.ms.auditcenter.service.log.service.ManageLogService;
import cn.hallele.leinsteining.ms.support.starter.components.audit.io.ApiLogIO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.function.Consumer;

/**
 * LogListener
 *
 * @author anle5
 * @since 2024/7/28 22:33
 */
@Slf4j
@Configuration
public class LogListener {
    @Autowired
    private ManageLogService manageLogService;

    @Bean
    public Consumer<ApiLogIO> audit() {
        return msg -> manageLogService.saveLog(msg);
    }
}
